package com.softline.documentsmall.controller;

import com.softline.documentsmall.entity.HotWord;
import com.softline.documentsmall.ret.ReturnVO;
import com.softline.documentsmall.ret.ReturnVOUtils;
import com.softline.documentsmall.service.HotWordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description:
 * @author: liusheng
 * @create: 2020-12-25
 * @ClassName: HotWordController
 */
@Api(value="搜索热词相关接口",tags={"搜索热词相关接口"})
@RestController
@RequestMapping("/hotWord")
@CrossOrigin(allowCredentials = "true",allowedHeaders = "*")
public class HotWordController {

    @Autowired
    HotWordService hotWordService;

    @ApiOperation(value="新增热词", notes = "新增热词")
    @PostMapping(value = "/insertWord")
    public ReturnVO insert(@RequestBody HotWord hotWord){

         return ReturnVOUtils.success(hotWordService.insertHotWord(hotWord));
    }

    @ApiOperation(value="数典列表", notes = "数典列表")
    @PostMapping(value = "/selectWord")
    public ReturnVO selectWord(String language,String name,Integer currPage,Integer pageSize){

        return ReturnVOUtils.success(hotWordService.selectWord(language,name,currPage,pageSize));
    }

    @ApiOperation(value="查找热词", notes = "查找热词")
    @PostMapping(value = "/selectHotWord")
    public ReturnVO selectHotWord(String language){
        return ReturnVOUtils.success(hotWordService.selectHotWord(language));
    }
}
